//
//  HYFComposeButton.swift
//  MyWeibo
//
//  Created by 黄勇锋 on 16/7/28.
//  Copyright © 2016年 黄勇锋. All rights reserved.
//

import UIKit

class HYFComposeButton: UIButton {
    
    //模型属性
    var componseInfo:HYFComponseButtonInfo?
    
    //干掉按钮高亮效果
    override var highlighted: Bool{
        
        get{
            
            return false
        }
        
        set{
   
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setupUI(){
        
        imageView?.contentMode = .Center
        //设置title
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        
    }
    
    //对子控件重新布局
    override func layoutSubviews() {
        
        super.layoutSubviews()
        
        //设置 imageView
        imageView?.frame = CGRect(x: 0, y: 0, width:self.frame.size.width, height: self.frame.size.width)
        
        // 设置title
        titleLabel?.frame = CGRect(x: 0, y: self.frame.width, width: self.frame.width, height: self.frame.height - self.frame.width)
    }
    
    
}
